<!DOCTYPE html>
<html>
<head>   
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>栏目管理</title>
    <meta name="keywords" content="用户管理">
    <meta name="description" content="用户管理">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__css/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMIN__css/animate.css" rel="stylesheet">
    <link href="__ADMIN__css/style.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/default/layer.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <style>
    #show img{width:60px; height: 60px; border-radius: 50%; box-shadow: 0 0 5px 1px #999;}
    .h10{height: 20px; }
    .modal-header{background: #3BB3A8; color: #fff;}
    #submit{ margin-right: 10px;}
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>栏目列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-4">
                            <div class="input-group">
                                <a href="{:U('Columns/goodadd')}" class="btn btn-outline btn-primary cd-popup-trigger">添加栏目</a>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>类型</th>
                                <th>栏目名称</th>    
                                <th>英文名称</th>
                                <th>seo标题</th>
                                <th>seo关键词</th>
                                <th>seo描述</th>
                                <th>是否前台菜单</th>
                                <th>状态</th>
                                <th>排序</th>
                                <th width="20%">操作</th>
                            </tr>
                            </thead>
                            <tbody id="show">
                                <volist name="list" id="vs">
                                    <tr>
                                        <td>{$vs.id}</td>
                                        <td>
                                            <if condition="$vs['type'] eq 1">
                                            文章
                                            <else/>
                                            产品
                                            </if>
                                        </td>
                                        <td>{$vs.html}{$vs.coltitle}</td>
                                        <td>{$vs.entitle}</td>
                                        <td>{$vs.seo_title}</td>
                                        <td>{$vs.seo_keywords|mb_substr = 0,6,"utf-8"}</td>
                                        <td>{$vs.seo_description|mb_substr = 0,6,"utf-8"}</td>
                                        <td>
                                            <if condition="$vs['is_nav'] eq 1">
                                            前台
                                            <else/>
                                            后台
                                            </if>
                                        </td>
                                        <td>
                                             <if condition="($vs.status eq 1)">
                                                <a href="javascript:Alterstate({$vs.id})" id="state{$vs.id}" class="label label-primary">正常</a>
                                            <else/>
                                                <a href="javascript:Alterstate({$vs.id})" id="state{$vs.id}" class="label label-danger">禁用</a>
                                            </if>
                                        </td>
                                        <td>{$vs.sort}</td>
                                        <td>
                                           <a href="{:U('Columns/goodadd?pid='.$vs['id'])}" class="label label-primary"><i class="fa fa-plus-square-o"></i>&nbsp;添加子栏目</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="{:U('Columns/gedit?id='.$vs['id'])}" class="label label-primary"><i class="fa fa-edit"></i> 修改</a>
                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="javascript:del({$vs.id});" class="label label-danger"><i class="fa fa-trash"></i> 删除</a>
                                        </td>
                                    </tr>   
                                </volist>
                                </tbody>
                        	</table>                        
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>

<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.js"></script>
<script src="__ADMIN__js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="__ADMIN__js/comment.js"></script>
<script>
function Alterstate(id){
    var objectState = $('#state'+id);
    comment.status("{:U('Columns/Alterstate')}",id,objectState);
}

function del(id){
    swal({   
        title: "主人确定要舍弃奴家吗？",  
        text: "",   
        type: "warning",   
        showCancelButton:true,   
        confirmButtonColor: "#ec6c62",   
        confirmButtonText: "果断舍弃！",   
        cancelButtonText: "让我想想！",   
        closeOnConfirm: false  
    },function(){   
        $.post("{:U('Columns/del')}",{id:id},function(data){
                if(data.status < 1){
                    swal({title:"很遗憾", text:data.mess, type:"error"});
                }else{
                    swal({title:"成功", text:data.mess, type:"success"},function(){
                       window.location.reload();//刷新页面 
                    });
                }
            },'json');
    });
}
</script>
</body>
</html>